package com.sino.struts2;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.sino.business.IExpertCommentService;
import com.sino.util.CreatQueryCondition;
import com.sino.util.PageControl;
import com.sino.model.ExpertModel;
import com.sino.model.ExpertReviewModel;

public class ExpertCommentAction extends ActionSupport {
    private IExpertCommentService expertCommentService;
	private ExpertReviewModel expertReviewModel;
	private List basicInfoList;

	private List expCommentList;
	

	private String page = "1";// 当前页

	private String pageStr;// 分页字符串

	private String qxkwTitle;

	private List expertList;// 专家列表

	private String zlid;

	private String fbh;

	private int pageRow;
	private String pid;



	
	public String getExpertReviewListByFBh() {
		Map session = ActionContext.getContext().getSession();
		ExpertModel em=(ExpertModel)session.get("expertModel");
		HttpServletRequest request = ServletActionContext.getRequest();
		PageControl pageControl = new PageControl();// 翻页控制类
		CreatQueryCondition creatQueryCondition = new CreatQueryCondition();// 条件查询类
		creatQueryCondition.initializtion(request);// 初始化查询条件
		pageControl.setPage(page);// 设置当前页
		pageControl.setPageSize(20);// 设置每页显示的记录数量
		pageControl.setRowCount(this.expertCommentService
				.getReviewPatentPageCount(creatQueryCondition.getHqlWhere(),String.valueOf(em.getFBh())));// 设置总记录数
		int startRow = (pageControl.getPage() - 1) * pageControl.getPageSize();// 开始行数
		int pageSize = pageControl.getPageSize();// 每页显示的数量
		pageStr = pageControl.getPageInfo(
				"getBasicinfoOfAssignExpert.action?method=notAssign&fbh="+em.getFBh(),
				creatQueryCondition.getCondition());
		basicInfoList = this.expertCommentService.getReviewPatentPageList(
				startRow, pageSize, creatQueryCondition.getHqlWhere(),String.valueOf(em.getFBh()));// 分页查询考生信息
		
		qxkwTitle = "北京市发明专利基本信息列表";
		this.setPageStr(pageStr);
		this.setPageRow(startRow);

		return SUCCESS;

	}

	public String getExmpertCommentListById() {
	    
		expCommentList = this.getExpertCommentService().getExpertComments(zlid);
		
		return SUCCESS;
	}
	public String saveExpertComment() {
		
			  
		expertReviewModel=this.getExpertCommentService().getExpertReview(pid);	
		this.setZlid(zlid);
		return SUCCESS;

	}
	public String upExpertComment(){
		
		if(expertReviewModel!=null){
			
			expertReviewModel=null;
		}
		this.setZlid(zlid);
	
		
		return SUCCESS;
	}
	public String saveExpertCommentDo() {
		this.getExpertCommentService().saveExpertComment(expertReviewModel);
	
		return SUCCESS;

	}
	public String delExpertComment() {
		this.getExpertCommentService().delComment(pid);
		return SUCCESS;

	}

	public List getBasicInfoList() {
		return basicInfoList;
	}

	public void setBasicInfoList(List basicInfoList) {
		this.basicInfoList = basicInfoList;
	}

	public List getExpertList() {
		return expertList;
	}

	public void setExpertList(List expertList) {
		this.expertList = expertList;
	}

	public String getPage() {
		return page;
	}

	public void setPage(String page) {
		this.page = page;
	}

	public int getPageRow() {
		return pageRow;
	}

	public void setPageRow(int pageRow) {
		this.pageRow = pageRow;
	}

	public String getPageStr() {
		return pageStr;
	}

	public void setPageStr(String pageStr) {
		this.pageStr = pageStr;
	}

	public String getQxkwTitle() {
		return qxkwTitle;
	}

	public void setQxkwTitle(String qxkwTitle) {
		this.qxkwTitle = qxkwTitle;
	}

	public String getZlid() {
		return zlid;
	}

	public void setZlid(String zlid) {
		this.zlid = zlid;
	}

	public IExpertCommentService getExpertCommentService() {
		return expertCommentService;
	}

	public void setExpertCommentService(
			IExpertCommentService expertCommentService) {
		this.expertCommentService = expertCommentService;
	}

	public List getExpCommentList() {
		return expCommentList;
	}

	public void setExpCommentList(List expCommentList) {
		this.expCommentList = expCommentList;
	}

	public String getFbh() {
		return fbh;
	}

	public void setFbh(String fbh) {
		this.fbh = fbh;
	}

	public ExpertReviewModel getExpertReviewModel() {
		return expertReviewModel;
	}

	public void setExpertReviewModel(ExpertReviewModel expertReviewModel) {
		this.expertReviewModel = expertReviewModel;
	}
	public String getPid() {
		return pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}
}
